home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / mslang / cp1 / drivsrch.c2 < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-15  |  2.4 KB  |  67 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville MI
  3. Date: 05-14-93 (08:49)             Number: 72
  4. From: BOB STOUT                    Refer#: 219
  5.   To: MARTIN CONNELLY               Recvd: NO  
  6. Subj: Re: DRIVSRCH.C (was PART       Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. In a message of <May 07 23:10>, Martin Connelly (1:340/303@fidonet) writes:
  9.  
  10.  >  I've missed all the previous posts. Out of the country. So, what
  11.  >  changed?
  12.  
  13. /*
  14.  * Name: DRIVSRCH.C
  15.  *
  16.  * Purpose: Replacement for Snippets DRIVSRCH.C that includes
  17.  *          detection of network drives for Novell NetWare, SUBST
  18.  *          drives, and works with Microsoft C.
  19.  *
  20.  * Notes:   Should work with any DOS compiler, but I don't have Borland or
  21.  *          Zortech to test it with. The Interrupt List shows this as
  22.  *          being valid for DOS 3.1+. May or may not produce 'correct'
  23.  *          results with other network operating systems.
  24.  *
  25.  * Credits: Ralf Brown for the infamous Interrupt List.
  26.  *
  27.  * Written by: David Gersic   26 April, 1993
  28.  *             Released to the public domain.
  29.  *
  30.  * Tested with: Microsoft C 6.00a, Compaq DOS 3.31, Novell NetWare 3.11
  31.  *
  32.  */
  33.  
  34. #include <stdio.h>
  35. #include <dos.h>
  36. #include <stdlib.h>
  37.  
  38. main()
  39. {
  40.     union REGS in, out;
  41.     int i;
  42.     char drives[]={' ','a','b','c','d','e','f','g', /* Netware uses up */
  43.                    'h','i','j','k','l','m','n','o', /* to 32 drive     */
  44.                    'p','q','r','s','t','u','v','w', /* 'letters'       */
  45.                    'x','y','z','[','\\',']','^','`'};
  46.  
  47.     in.x.ax=0x4409; /* IOCTL function - CHECK IF BLOCK DEVICE REMOTE */
  48.     for(i=1;i<32;i++)
  49.     {
  50.          in.h.bl=(unsigned char)i;  /* 1==a:, 2==b:, etc. */
  51.          intdos(&in,&out);
  52.          if(!out.x.cflag)   /* carry flag set on error */
  53.                             /* bit 15 == subst, bit 12 == 'remote' */
  54.               printf("drive %c: is %s\n",
  55.               drives[i],out.x.dx & 1<<15 ? "subst" :
  56.               out.x.dx & 1<<12 ? "network" : "local");
  57.     }
  58.     return(0);
  59. }
  60.  
  61.  
  62. --- QM v1.00
  63.  * Origin: MicroFirm : Down to the C in chips (1:106/2000.6)
  64. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  65. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 261/1023
  66. SEEN-BY: 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  67.